package com.le.tester.javaThink.fourth.concurrency;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * createTime：2021/9/15 13:57
 * description：run方法中抛出异常
 */
public class ExceptionThread implements Runnable {

    @Override
    public void run() {
        throw new RuntimeException();
    }

    public static void main(String[] args) {
        try {
            ExecutorService service = Executors.newCachedThreadPool();
            //这里默认的去执行了run方法，并不用显示的调用run
            service.execute(new ExceptionThread());
        } catch (Exception e) {
            System.out.println("It is has been handled");
            throw new RuntimeException(e.getMessage());
        }
    }
}
